//
//  CalibrateAccelerometer.h
//  ProjectL
//
//  Created by Nguyen Tan Loc on 12/4/13.
//  Copyright (c) 2013 Nguyen Tan Loc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AccelerometerFilter.h"

#define TILT_FACTOR_IN_DEGREE   2
#define TILT_WIDTH_IN_DEGREE    uniPos(45, 45)
#define TILT_WIDTH_IN_RADIAN    uniPos(0.707, 0.707)

typedef enum
{
    eAT_TOP_DOWN = 0,
    eAT_REGULAR,
    eAT_CUSTOM,
} ACCELEROMETER_TYPE;

@interface CalibrateAccelerometer : NSObject
{
    float mOriginAngle;
    float mSumCalibrate;
    int   mCountCalibrate;
    float x, y, z;
    LowpassFilter *mLowPassFilter;
}

@property (nonatomic, readonly) float _x, _y, _z;
@property (nonatomic, readonly) float _originAngle;

+(CalibrateAccelerometer *) getInstance;
-(void) setType:(ACCELEROMETER_TYPE) type;
-(void) addSumCalibrate:(UIAcceleration *) acc;
-(void) averageOriginAngel;
-(void) calibrate:(UIAcceleration *) acc;

@end
